package com.wmlive.hhvideo.heihei.mainhome.adapter;

import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import cn.wmlive.hhvideo.R;
import com.wmlive.hhvideo.heihei.beans.main.ShortVideoItem;
import com.wmlive.hhvideo.utils.KLog;
import com.wmlive.hhvideo.utils.imageloader.GlideLoader;
import com.wmlive.hhvideo.widget.refreshrecycler.BaseRecyclerViewHolder;
import com.wmlive.hhvideo.widget.refreshrecycler.RefreshAdapter;
import com.wmlive.hhvideo.widget.refreshrecycler.RefreshRecyclerView;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by vhawk on 2017/6/1.
 */

public class ExplosionAdapter extends RefreshAdapter<ExplosionAdapter.ExplosionViewHolder, ShortVideoItem> {


    public ExplosionAdapter(List list, RefreshRecyclerView refreshView) {
        super(list, refreshView);
    }

    @Override
    public ExplosionViewHolder onCreateHolder(ViewGroup parent, int viewType) {

        return new ExplosionViewHolder(parent, R.layout.item_explosion);
    }

    @Override
    public void onBindHolder(ExplosionViewHolder holder, int position, ShortVideoItem data) {

        holder.tvMusicName.setText(data.getMusic_name());
        holder.tvLoveCount.setText(data.getLike_count()+"");
        holder.tvPlayCount.setText(data.getPlay_count()+"");
        GlideLoader.loadImage(data.getOpus_small_cover(),holder.ivSplash,R.drawable.bg_video_default_4_3);
    }

    public class ExplosionViewHolder extends BaseRecyclerViewHolder {

        @BindView(R.id.iv_splash)
        ImageView ivSplash;
        @BindView(R.id.tv_play_count)
        TextView tvPlayCount;
        @BindView(R.id.tv_love_count)
        TextView tvLoveCount;
        @BindView(R.id.tv_music_name)
        TextView tvMusicName;

        public ExplosionViewHolder(ViewGroup parent, int layoutId) {
            super(parent, layoutId);
            ButterKnife.bind(this, getRootView());
        }
    }
}
